package com.szqhyxj.youxiangju.biz.merchantHome.shop.order;

import com.szqhyxj.youxiangju.biz.merchantHome.bean.FacilityList;
import com.szqhyxj.youxiangju.biz.merchantHome.bean.OrderDeetails;
import com.szqhyxj.youxiangju.biz.merchantHome.shop.OrderList;
import com.szqhyxj.youxiangju.sys.BaseResult;
import com.szqhyxj.youxiangju.sys.RetrofitFacade;

import java.util.List;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;

/**
 * XiaoPanYu
 * on 2018/11/5
 */
public class OrderModel{

    public interface OrderService {

        @POST("orderPosInfo/myOrder")
        Observable<BaseResult<OrderList>> getOrderList();

        @FormUrlEncoded
        @POST("orderPosInfo/confirmReceipt")
        Observable<BaseResult> confirmReceipt( @Field("orderNo") String orderNo);

        ///orderPosInfo/orderDetail
        @FormUrlEncoded
        @POST("orderPosInfo/orderDetail")
        Observable<BaseResult<OrderDeetails>> getOrderDetail( @Field("orderNo") String orderNo);

        @FormUrlEncoded
        @POST("orderPosInfo/orderDevice")
        Observable<BaseResult<List<FacilityList>>> getPosList(@Field("orderNo") String orderNo);
    }

    //获取订单列表
    public static Observable<BaseResult<OrderList>> getOrderList () {
        return RetrofitFacade.Companion.getRetrofit().create(OrderService.class).getOrderList();
    }

    //确定收货
    public static Observable<BaseResult> confirmReceipt (String orderNo) {
        return RetrofitFacade.Companion.getRetrofit().create(OrderService.class).confirmReceipt(orderNo);
    }

    //获取订单详情
    public static Observable<BaseResult<OrderDeetails>> getOrderDetail (String orderNo) {
        return RetrofitFacade.Companion.getRetrofit().create(OrderService.class).getOrderDetail(orderNo);
    }

    //获取订单机器列表
    public static Observable<BaseResult<List<FacilityList>>> getPosList (String orderNo) {
        return RetrofitFacade.Companion.getRetrofit().create(OrderService.class).getPosList(orderNo);
    }


}
